<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Racc::Grammar - racc: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
        
<div id="extends-section" class="nav-section">
  <h3>Extended With Modules</h3>

  <ul class="link-list">
    <li><span class="extend">Forwardable</span>
  </ul>
</div>

        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-define">::define</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-5B-5D">#[]</a>
    <li ><a href="#method-i-_compute_expand">#_compute_expand</a>
    <li ><a href="#method-i-add">#add</a>
    <li ><a href="#method-i-add_start_rule">#add_start_rule</a>
    <li ><a href="#method-i-added-3F">#added?</a>
    <li ><a href="#method-i-check_rules_nullable">#check_rules_nullable</a>
    <li ><a href="#method-i-check_rules_useless">#check_rules_useless</a>
    <li ><a href="#method-i-check_symbols_nullable">#check_symbols_nullable</a>
    <li ><a href="#method-i-check_symbols_useless">#check_symbols_useless</a>
    <li ><a href="#method-i-compute_expand">#compute_expand</a>
    <li ><a href="#method-i-compute_hash">#compute_hash</a>
    <li ><a href="#method-i-compute_heads">#compute_heads</a>
    <li ><a href="#method-i-compute_locate">#compute_locate</a>
    <li ><a href="#method-i-compute_nullable">#compute_nullable</a>
    <li ><a href="#method-i-compute_nullable_0">#compute_nullable_0</a>
    <li ><a href="#method-i-compute_useless">#compute_useless</a>
    <li ><a href="#method-i-declare_precedence">#declare_precedence</a>
    <li ><a href="#method-i-determine_terminals">#determine_terminals</a>
    <li ><a href="#method-i-dfa">#dfa</a>
    <li ><a href="#method-i-each">#each</a>
    <li ><a href="#method-i-each_index">#each_index</a>
    <li ><a href="#method-i-each_rule">#each_rule</a>
    <li ><a href="#method-i-each_useless_nonterminal">#each_useless_nonterminal</a>
    <li ><a href="#method-i-each_useless_rule">#each_useless_rule</a>
    <li ><a href="#method-i-each_with_index">#each_with_index</a>
    <li ><a href="#method-i-end_precedence_declaration">#end_precedence_declaration</a>
    <li ><a href="#method-i-fix_ident">#fix_ident</a>
    <li ><a href="#method-i-init">#init</a>
    <li ><a href="#method-i-intern">#intern</a>
    <li ><a href="#method-i-n_useless_nonterminals">#n_useless_nonterminals</a>
    <li ><a href="#method-i-n_useless_rules">#n_useless_rules</a>
    <li ><a href="#method-i-nfa">#nfa</a>
    <li ><a href="#method-i-nonterminal_base">#nonterminal_base</a>
    <li ><a href="#method-i-parser_class">#parser_class</a>
    <li ><a href="#method-i-size">#size</a>
    <li ><a href="#method-i-start_symbol-3D">#start_symbol=</a>
    <li ><a href="#method-i-state_transition_table">#state_transition_table</a>
    <li ><a href="#method-i-states">#states</a>
    <li ><a href="#method-i-symbols">#symbols</a>
    <li ><a href="#method-i-to_s">#to_s</a>
    <li ><a href="#method-i-useless_nonterminal_exist-3F">#useless_nonterminal_exist?</a>
    <li ><a href="#method-i-useless_rule_exist-3F">#useless_rule_exist?</a>
    <li ><a href="#method-i-write_log">#write_log</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Racc::Grammar">
    <h1 id="class-Racc::Grammar" class="class">
      class Racc::Grammar
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-n_expected_srconflicts" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">n_expected_srconflicts</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-start" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">start</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-symboltable" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">symboltable</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-define" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">define</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Dynamic Generation Interface</p>

                              <div class="method-source-code" id="define-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 201</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Grammar</span>.<span class="ruby-identifier ruby-title">define</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">env</span> = <span class="ruby-constant">DefinitionEnv</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-identifier">env</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">env</span>.<span class="ruby-identifier">grammar</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(debug_flags = DebugFlags.new)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 24</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">debug_flags</span> = <span class="ruby-constant">DebugFlags</span>.<span class="ruby-identifier">new</span>)
  <span class="ruby-ivar">@symboltable</span> = <span class="ruby-constant">SymbolTable</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@debug_symbol</span> = <span class="ruby-identifier">debug_flags</span>.<span class="ruby-identifier">token</span>
  <span class="ruby-ivar">@rules</span>   = []  <span class="ruby-comment"># :: [Rule]</span>
  <span class="ruby-ivar">@start</span>   = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@n_expected_srconflicts</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@prec_table</span> = []
  <span class="ruby-ivar">@prec_table_closed</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@closed</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@states</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-5B-5D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">[]</span><span
                                class="method-args">(x)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="5B-5D-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">[]</span>(<span class="ruby-identifier">x</span>)
  <span class="ruby-ivar">@rules</span>[<span class="ruby-identifier">x</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add</span><span
                                class="method-args">(rule)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Grammar.html"><code>Grammar</code></a> Definition Interface</p>

                              <div class="method-source-code" id="add-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 166</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add</span>(<span class="ruby-identifier">rule</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;rule added after the Grammar closed&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@closed</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">rule</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-added-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">added?</span><span
                                class="method-args">(sym)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="added-3F-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 171</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">added?</span>(<span class="ruby-identifier">sym</span>)
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">detect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">target</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">sym</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-declare_precedence" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">declare_precedence</span><span
                                class="method-args">(assoc, syms)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="declare_precedence-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 180</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">declare_precedence</span>(<span class="ruby-identifier">assoc</span>, <span class="ruby-identifier">syms</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">CompileError</span>, <span class="ruby-string">&quot;precedence table defined twice&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@prec_table_closed</span>
  <span class="ruby-ivar">@prec_table</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">assoc</span>, <span class="ruby-identifier">syms</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-dfa" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">dfa</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="dfa-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 120</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">dfa</span>
  (<span class="ruby-ivar">@states</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">States</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>)).<span class="ruby-identifier">dfa</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Grammar.html#method-i-states">states</a>
                            </div>

                          </div>

                  <div id="method-i-each" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">each</span><span
                                class="method-args">(&amp;block)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Grammar.html#method-i-each_rule">each_rule</a>
                            </div>
                          </div>

                  <div id="method-i-each_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_index</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_index-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 50</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_index</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each_index</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each_rule" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_rule</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_rule-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 44</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_rule</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Grammar.html#method-i-each">each</a>
                            </div>

                          </div>

                  <div id="method-i-each_useless_nonterminal" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_useless_nonterminal</span><span
                                class="method-args">() { |sym| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_useless_nonterminal-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 92</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_useless_nonterminal</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">to_enum</span> <span class="ruby-identifier">__method__</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>

  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">each_nonterminal</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">sym</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">useless?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each_useless_rule" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_useless_rule</span><span
                                class="method-args">() { |r| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_useless_rule-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 108</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_useless_rule</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">to_enum</span> <span class="ruby-identifier">__method__</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>

  <span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">r</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">useless?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each_with_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_with_index</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_with_index-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 54</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_with_index</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each_with_index</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-end_precedence_declaration" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">end_precedence_declaration</span><span
                                class="method-args">(reverse)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="end_precedence_declaration-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 185</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">end_precedence_declaration</span>(<span class="ruby-identifier">reverse</span>)
  <span class="ruby-ivar">@prec_table_closed</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@prec_table</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">table</span> = <span class="ruby-identifier">reverse</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@prec_table</span>.<span class="ruby-identifier">reverse</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@prec_table</span>
  <span class="ruby-identifier">table</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">assoc</span>, <span class="ruby-identifier">syms</span>), <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">assoc</span> = <span class="ruby-identifier">assoc</span>
      <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">precedence</span> = <span class="ruby-identifier">idx</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-init" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">init</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Computation</p>

                              <div class="method-source-code" id="init-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 409</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">init</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@closed</span>
  <span class="ruby-ivar">@closed</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-ivar">@start</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">target</span> }.<span class="ruby-identifier">detect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">dummy?</span> }
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">CompileError</span>, <span class="ruby-string">&#39;no rule in input&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">add_start_rule</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">freeze</span>
  <span class="ruby-identifier">fix_ident</span>
  <span class="ruby-identifier">compute_hash</span>
  <span class="ruby-identifier">compute_heads</span>
  <span class="ruby-identifier">determine_terminals</span>
  <span class="ruby-identifier">compute_nullable_0</span>
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">fix</span>
  <span class="ruby-identifier">compute_locate</span>
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">each_nonterminal</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">compute_expand</span> <span class="ruby-identifier">t</span> }
  <span class="ruby-identifier">compute_nullable</span>
  <span class="ruby-identifier">compute_useless</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-intern" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">intern</span><span
                                class="method-args">(value, dummy = false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="intern-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">intern</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">dummy</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">intern</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">dummy</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-n_useless_nonterminals" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">n_useless_nonterminals</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="n_useless_nonterminals-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 88</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">n_useless_nonterminals</span>
  <span class="ruby-ivar">@n_useless_nonterminals</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">each_useless_nonterminal</span>.<span class="ruby-identifier">count</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-n_useless_rules" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">n_useless_rules</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="n_useless_rules-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 104</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">n_useless_rules</span>
  <span class="ruby-ivar">@n_useless_rules</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">each_useless_rule</span>.<span class="ruby-identifier">count</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-nfa" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">nfa</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="nfa-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 116</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">nfa</span>
  (<span class="ruby-ivar">@states</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">States</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>)).<span class="ruby-identifier">nfa</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-nonterminal_base" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">nonterminal_base</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="nonterminal_base-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 80</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">nonterminal_base</span>
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">nt_base</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parser_class" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parser_class</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="parser_class-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 130</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parser_class</span>
  <span class="ruby-identifier">states</span> = <span class="ruby-identifier">states</span>()   <span class="ruby-comment"># cache</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
    <span class="ruby-identifier">srcfilename</span> = <span class="ruby-identifier">caller</span>(<span class="ruby-value">1</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-regexp">/\A(.*?):/</span>, <span class="ruby-value">1</span>)
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">write_log</span> <span class="ruby-identifier">srcfilename</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;.output&quot;</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">SystemCallError</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">report</span> = <span class="ruby-identifier">lambda</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;racc: #{srcfilename}: #{s}&quot;</span> }
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">states</span>.<span class="ruby-identifier">should_report_srconflict?</span>
      <span class="ruby-identifier">report</span>[<span class="ruby-node">&quot;#{states.n_srconflicts} shift/reduce conflicts&quot;</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">states</span>.<span class="ruby-identifier">rrconflict_exist?</span>
      <span class="ruby-identifier">report</span>[<span class="ruby-node">&quot;#{states.n_rrconflicts} reduce/reduce conflicts&quot;</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">g</span> = <span class="ruby-identifier">states</span>.<span class="ruby-identifier">grammar</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">g</span>.<span class="ruby-identifier">useless_nonterminal_exist?</span>
      <span class="ruby-identifier">report</span>[<span class="ruby-node">&quot;#{g.n_useless_nonterminals} useless nonterminals&quot;</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">g</span>.<span class="ruby-identifier">useless_rule_exist?</span>
      <span class="ruby-identifier">report</span>[<span class="ruby-node">&quot;#{g.n_useless_rules} useless rules&quot;</span>]
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">states</span>.<span class="ruby-identifier">state_transition_table</span>.<span class="ruby-identifier">parser_class</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-size" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">size</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="size-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 58</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">size</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">size</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start_symbol-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">start_symbol=</span><span
                                class="method-args">(s)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="start_symbol-3D-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 175</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">start_symbol=</span>(<span class="ruby-identifier">s</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">CompileError</span>, <span class="ruby-string">&quot;start symbol set twice&#39;&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@start</span>
  <span class="ruby-ivar">@start</span> = <span class="ruby-identifier">s</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-state_transition_table" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">state_transition_table</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="state_transition_table-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 126</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">state_transition_table</span>
  <span class="ruby-identifier">states</span>().<span class="ruby-identifier">state_transition_table</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-states" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">states</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Grammar.html#method-i-dfa">dfa</a>
                            </div>
                          </div>

                  <div id="method-i-symbols" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">symbols</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="symbols-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 76</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">symbols</span>
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">symbols</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_s</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="to_s-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 62</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
  <span class="ruby-string">&quot;&lt;Racc::Grammar&gt;&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-useless_nonterminal_exist-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">useless_nonterminal_exist?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="useless_nonterminal_exist-3F-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 84</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">useless_nonterminal_exist?</span>
  <span class="ruby-identifier">n_useless_nonterminals</span>() <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-useless_rule_exist-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">useless_rule_exist?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="useless_rule_exist-3F-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">useless_rule_exist?</span>
  <span class="ruby-identifier">n_useless_rules</span>() <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-write_log" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">write_log</span><span
                                class="method-args">(path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="write_log-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 156</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">write_log</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>, <span class="ruby-string">&#39;w&#39;</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-constant">LogFileGenerator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">states</span>()).<span class="ruby-identifier">output</span> <span class="ruby-identifier">f</span>
  }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-_compute_expand" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_compute_expand</span><span
                                class="method-args">(t, set, lock)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_compute_expand-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 504</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_compute_expand</span>(<span class="ruby-identifier">t</span>, <span class="ruby-identifier">set</span>, <span class="ruby-identifier">lock</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">tmp</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">expand</span>
    <span class="ruby-identifier">set</span>.<span class="ruby-identifier">update</span> <span class="ruby-identifier">tmp</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">set</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">tok</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">set</span>.<span class="ruby-identifier">update_a</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">heads</span>
  <span class="ruby-identifier">t</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ptr</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">tok</span> = <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">dereference</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">tok</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">tok</span>.<span class="ruby-identifier">nonterminal?</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">lock</span>[<span class="ruby-identifier">tok</span>.<span class="ruby-identifier">ident</span>]
        <span class="ruby-identifier">lock</span>[<span class="ruby-identifier">tok</span>.<span class="ruby-identifier">ident</span>] = <span class="ruby-keyword">true</span>
        <span class="ruby-identifier">_compute_expand</span> <span class="ruby-identifier">tok</span>, <span class="ruby-identifier">set</span>, <span class="ruby-identifier">lock</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">set</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_start_rule" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_start_rule</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_start_rule-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 430</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_start_rule</span>
  <span class="ruby-identifier">r</span> = <span class="ruby-constant">Rule</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">dummy</span>,
               [<span class="ruby-ivar">@start</span>, <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">anchor</span>, <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">anchor</span>],
               <span class="ruby-constant">UserAction</span>.<span class="ruby-identifier">empty</span>)
  <span class="ruby-identifier">r</span>.<span class="ruby-identifier">ident</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">r</span>.<span class="ruby-identifier">hash</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">r</span>.<span class="ruby-identifier">precedence</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-identifier">r</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_rules_nullable" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_rules_nullable</span><span
                                class="method-args">(rules)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_rules_nullable-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 537</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_rules_nullable</span>(<span class="ruby-identifier">rules</span>)
  <span class="ruby-identifier">rules</span>.<span class="ruby-identifier">delete_if</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">null</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">symbols</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">nullable?</span>
        <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">null</span> = <span class="ruby-keyword">false</span>
        <span class="ruby-keyword">break</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">nullable?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_rules_useless" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_rules_useless</span><span
                                class="method-args">(rules)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_rules_useless-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 578</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_rules_useless</span>(<span class="ruby-identifier">rules</span>)
  <span class="ruby-identifier">rules</span>.<span class="ruby-identifier">delete_if</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">useless</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">symbols</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">useless?</span>
        <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">useless</span> = <span class="ruby-keyword">true</span>
        <span class="ruby-keyword">break</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">not</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">useless?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_symbols_nullable" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_symbols_nullable</span><span
                                class="method-args">(symbols)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_symbols_nullable-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 550</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_symbols_nullable</span>(<span class="ruby-identifier">symbols</span>)
  <span class="ruby-identifier">symbols</span>.<span class="ruby-identifier">delete_if</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ptr</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">nullable?</span>
        <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">null</span> = <span class="ruby-keyword">true</span>
        <span class="ruby-keyword">break</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">nullable?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_symbols_useless" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_symbols_useless</span><span
                                class="method-args">(s)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_symbols_useless-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 591</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_symbols_useless</span>(<span class="ruby-identifier">s</span>)
  <span class="ruby-identifier">s</span>.<span class="ruby-identifier">delete_if</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">t</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ptr</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">useless?</span>
        <span class="ruby-identifier">t</span>.<span class="ruby-identifier">useless</span> = <span class="ruby-keyword">false</span>
        <span class="ruby-keyword">break</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">not</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">useless?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compute_expand" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compute_expand</span><span
                                class="method-args">(t)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Sym.html#attribute-i-expand"><code>Sym#expand</code></a></p>

                              <div class="method-source-code" id="compute_expand-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 498</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compute_expand</span>(<span class="ruby-identifier">t</span>)
  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;expand&gt; #{t.to_s}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@debug_symbol</span>
  <span class="ruby-identifier">t</span>.<span class="ruby-identifier">expand</span> = <span class="ruby-identifier">_compute_expand</span>(<span class="ruby-identifier">t</span>, <span class="ruby-constant">ISet</span>.<span class="ruby-identifier">new</span>, [])
  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;expand&lt; #{t.to_s}: #{t.expand.to_s}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@debug_symbol</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compute_hash" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compute_hash</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Rule.html#attribute-i-hash"><code>Rule#hash</code></a></p>

                              <div class="method-source-code" id="compute_hash-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 449</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compute_hash</span>
  <span class="ruby-identifier">hash</span> = <span class="ruby-value">4</span>   <span class="ruby-comment"># size of dummy rule</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">hash</span> = <span class="ruby-identifier">hash</span>
    <span class="ruby-identifier">hash</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compute_heads" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compute_heads</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Sym.html#attribute-i-heads"><code>Sym#heads</code></a></p>

                              <div class="method-source-code" id="compute_heads-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 458</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compute_heads</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">ptrs</span>[<span class="ruby-value">0</span>]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compute_locate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compute_locate</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Sym.html#attribute-i-locate"><code>Sym#locate</code></a></p>

                              <div class="method-source-code" id="compute_locate-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 483</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compute_locate</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">t</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">ptrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ptr</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">reduce?</span>
        <span class="ruby-identifier">tok</span> = <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">dereference</span>
        <span class="ruby-identifier">tok</span>.<span class="ruby-identifier">locate</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">ptr</span>
        <span class="ruby-identifier">t</span> = <span class="ruby-identifier">tok</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">tok</span>.<span class="ruby-identifier">terminal?</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">precedence</span> = <span class="ruby-identifier">t</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compute_nullable" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compute_nullable</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Sym.html#method-i-nullable-3F"><code>Sym#nullable?</code></a>, <a href="Rule.html#method-i-nullable-3F"><code>Rule#nullable?</code></a></p>

                              <div class="method-source-code" id="compute_nullable-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 524</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compute_nullable</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span>       {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">null</span> = <span class="ruby-keyword">false</span> }
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">null</span> = <span class="ruby-keyword">false</span> }
  <span class="ruby-identifier">r</span> = <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">s</span> = <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">nonterminals</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">rs</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-identifier">ss</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-identifier">check_rules_nullable</span> <span class="ruby-identifier">r</span>
    <span class="ruby-identifier">check_symbols_nullable</span> <span class="ruby-identifier">s</span>
  <span class="ruby-keyword">end</span> <span class="ruby-keyword">until</span> <span class="ruby-identifier">rs</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">size</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">ss</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">size</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compute_nullable_0" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compute_nullable_0</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Sym.html#method-i-self_null-3F"><code>Sym#self_null?</code></a></p>

                              <div class="method-source-code" id="compute_nullable_0-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 472</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compute_nullable_0</span>
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">terminal?</span>
      <span class="ruby-identifier">s</span>.<span class="ruby-identifier">snull</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">s</span>.<span class="ruby-identifier">snull</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">loc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">loc</span>.<span class="ruby-identifier">reduce?</span> }
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compute_useless" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compute_useless</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Sym.html#method-i-useless-3F"><code>Sym#useless?</code></a>, <a href="Rule.html#method-i-useless-3F"><code>Rule#useless?</code></a> FIXME: what means “useless”?</p>

                              <div class="method-source-code" id="compute_useless-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 564</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compute_useless</span>
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">each_terminal</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">useless</span> = <span class="ruby-keyword">false</span> }
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">each_nonterminal</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">useless</span> = <span class="ruby-keyword">true</span> }
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">useless</span> = <span class="ruby-keyword">true</span> }
  <span class="ruby-identifier">r</span> = <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">s</span> = <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">nonterminals</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">rs</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-identifier">ss</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-identifier">check_rules_useless</span> <span class="ruby-identifier">r</span>
    <span class="ruby-identifier">check_symbols_useless</span> <span class="ruby-identifier">s</span>
  <span class="ruby-keyword">end</span> <span class="ruby-keyword">until</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">rs</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ss</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-determine_terminals" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">determine_terminals</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Sym.html#method-i-terminal-3F"><code>Sym#terminal?</code></a></p>

                              <div class="method-source-code" id="determine_terminals-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 465</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">determine_terminals</span>
  <span class="ruby-ivar">@symboltable</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">s</span>.<span class="ruby-identifier">term</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-fix_ident" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">fix_ident</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Rule.html#attribute-i-ident"><code>Rule#ident</code></a> <a href="LocationPointer.html#attribute-i-ident"><code>LocationPointer#ident</code></a></p>

                              <div class="method-source-code" id="fix_ident-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/grammar.rb, line 442</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">fix_ident</span>
  <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">ident</span> = <span class="ruby-identifier">idx</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

